<?php

namespace App\Models;


use App\Http\Traits\GlobalConstant;

class Users extends Orm
{
    //
    protected $table = 'users';
    protected $dateFormat = 'U';
    public $timestamps = true;

    public $appends = [
        'role'
    ];

    public function setAvatarAttribute($value)
    {
        $this->dealSetImageAttribute('avatar', $value);
    }

    public function getRoleAttribute()
    {
        $roleId = $this->attributes['role_id'];
        return GlobalConstant::getRoleMap($roleId);
    }

}
